home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Security
/
FULL - Iolo Drive Scrubber 3.5
/
DriveScrubber3.exe
/
{code_GetDSDir}
/
dshtml.dll
/
1033
/
HTML
/
LIBRARY.JS
< prev
Wrap
Text File
|
2008-02-07
|
14KB
|
590 lines
//var language = 'english';
var language = 'french';
window.onresize = function() {
scaleDiv();
scaleDivTools();
//scaleDivTools() ;
};
window.onscroll = function()
{
scaleDiv();
};
window.onload = function()
{
SetLanguageFile();
scaleDiv();
document.body.onselectstart = function ()
{
return false;
}
document.body.ondragstart = function () {
return false;
}
};
function SetLanguageFile()
{
var newjs=document.createElement('script');
newjs.type='text/javascript';
switch (language)
{
case 'english':
//alert(language);
newjs.src='english.js';
break
case 'french':
//alert(language);
newjs.src='french.js';
break
default:
//alert(language);
}
document.getElementsByTagName('head')[0].appendChild(newjs);
try
{
SetLanguage(language);
}catch(e)
{
//alert('No SetLanguage function, or id not found');
}
}
// Add functions to window.onload
function AddLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
function GrayOut(vis, options) {
// Pass true to gray out screen, false to ungray
// options are optional. This is a JSON object with the following (optional) properties
// opacity:0-100 // Lower number = less grayout higher = more of a blackout
// zindex: # // HTML elements with a higher zindex appear on top of the gray out
// bgcolor: (#xxxxxx) // Standard RGB Hex color code
// grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
// Because options is JSON opacity/zindex/bgcolor are all optional and can appear
// in any order. Pass only the properties you need to set.
var darkDivId = 'dimmer';
var options = options || {};
var zindex = options.zindex || 50;
var opacity = options.opacity || 80;
var opaque = (opacity / 80);
var bgcolor = options.bgcolor || '#404040';
var dark=document.getElementById(darkDivId);
if (!dark) {
// The dark layer doesn't exist, it's never been created. So we'll
// create it here and apply some basic styles.
// If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
var tbody = document.getElementsByTagName("body")[0];
var tnode = document.createElement('div'); // Create the layer.
tnode.style.position='absolute'; // Position absolutely
tnode.style.top='0px'; // In the top
tnode.style.left='0px'; // Left corner of the page
tnode.style.overflow='hidden'; // Try to avoid making scroll bars
tnode.style.display='none'; // Start out Hidden
tnode.id=darkDivId; // Name it so we can find it later
tbody.appendChild(tnode); // Add it to the web page
dark=document.getElementById(darkDivId); // Get the object.
}
if (vis) {
//alert(GetScrollTop());
//alert(screen.height + " " + document.body.scrollHeight + " " + document.body.offsetHeight );
// Calculate the page width and height
if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
var pageWidth = document.body.scrollWidth+'px';
var pageHeight = document.body.scrollHeight+'px';
}
else if( document.body.offsetWidth ) {
var pageWidth = document.body.offsetWidth+'px';
var pageHeight = document.body.offsetHeight+'px';
} else {
var pageWidth='100%';
var pageHeight='100%';
}
//set the shader to cover the entire page and make it visible.
dark.style.opacity=opaque;
dark.style.MozOpacity=opaque;
dark.style.filter='alpha(opacity='+opacity+')';
dark.style.zIndex=zindex;
dark.style.backgroundColor=bgcolor;
dark.style.width= '100%';
// if(document.body.scrollHeight> 300)
// {
// dark.style.height= pageHeight;
// }else
// {
// dark.style.height= '100%';
// }
dark.style.height= document.documentElement.clientHeight;
dark.style.display='block';
//document.body.style.scrollbarBaseColor = '#404040';
document.body.className = "body_gray_scrollbar";
document.documentElement.className = "body_gray_scrollbar";
document.body.style.scrolling = 'no';
scaleDiv();
} else {
dark.style.display='none';
//document.body.style.scrollbarBaseColor = '';
document.body.style.scrolling = 'auto';
document.body.className = "";
document.documentElement.className = "";
}
}
function GetScrollTop()
{
var theTop = 0;
if (document.documentElement && document.documentElement.scrollTop)
theTop = document.documentElement.scrollTop;
else if (document.body)
theTop = document.body.scrollTop
return theTop;
}
// This function begins the animation of the panel element by setting the height
// to 1 pixel and setting the other animation properties. The return value is the
// starting height of the panel to be used by the display element's internal
// height tracking mechanism.
function Animate_BeginAnimation(panelId)
{
var panel = document.getElementById(panelId);
Animate_SetPanelHeight(panelId, 1);
panel.style.overflow = "hidden";
panel.style.display = "block";
return 1;
}
// This function ends the animation of the panel element by setting the overflow
// of the panel to visible to ensure the panel makes it to it's correct height. The
// return value of this function is the current height of the panel.
function Animate_EndAnimation(panelId)
{
var panel = document.getElementById(panelId);
panel.style.overflow = "visible";
return panel.offsetHeight;
}
function Animate_SetPanelHeight(panelId, height)
{
var panel = document.getElementById(panelId);
panel.style.height = height + "px";
}
function Get(id)
{
return document.getElementById(id);
}
function SetClass(id, className)
{
var element = document.getElementById(id);
element.className = className;
}
function SetDisplay(id, display)
{
var element = document.getElementById(id);
element.style.display = display;
}
// id : id of the control
// value : boolean (true/ false )
// UseBlock : bool , use block to display
function SetDisplayWidget( id , value, UseBlock )
{
var type = UseBlock ? "block" : "inline";
if ( value )
Get(id).style.display = type;
else
Get(id).style.display = "none";
}
// id : id of the control
// value : boolean (true/ false )
function SetVisibility( id , value )
{
if ( value )
Get(id).style.visibility = "visible";
else
Get(id).style.visibility = "hidden";
}
function ToggleDisplay(id)
{
var element = document.getElementById(id);
if (element.style.display == "none")
element.style.display = "block";
else
element.style.display = "none";
}
function ToggleWidget(divid , imgid)
{
var imgmax = "maximize.gif";
var imgmin = "minimize.gif";
var img = document.getElementById(imgid);
var element = document.getElementById(divid);
if (element.style.display == "none")
{
element.style.display = "block";
img.src = imgmin;
}
else
{
element.style.display = "none";
img.src = imgmax;
}
}
function ToggleWidgetChild(id , imgid)
{
var imgmax = "plus.gif";
var imgmin = "minus.gif";
var img = document.getElementById(imgid);
var element = document.getElementById(id);
if (element.style.display == "none")
{
element.style.display = "block";
img.src = imgmin;
}
else
{
element.style.display = "none";
img.src = imgmax;
}
}
var ns4 = (document.layers)? true:false;
var ie4 = (document.all)? true:false;
function findPosX(id)
{
var obj = document.getElementById(id);
var curleft = 0;
if(obj.offsetParent)
while(1)
{
curleft += obj.offsetLeft;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.x)
curleft += obj.x;
return curleft;
}
function findPosY(id)
{
var obj = document.getElementById(id);
var curtop = 0;
if(obj.offsetParent)
while(1)
{
curtop += obj.offsetTop;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.y)
curtop += obj.y;
return curtop;
}
function URLEncode(text )
{
// The Javascript escape and unescape functions do not correspond
// with what browsers actually do...
var SAFECHARS = "0123456789" + // Numeric
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic
"abcdefghijklmnopqrstuvwxyz" +
"-_.!~*'()"; // RFC2396 Mark characters
var HEX = "0123456789ABCDEF";
var plaintext = text;
var encoded = "";
for (var i = 0; i < plaintext.length; i++ ) {
var ch = plaintext.charAt(i);
if (ch == " ") {
encoded += "+"; // x-www-urlencoded, rather than %20
} else if (SAFECHARS.indexOf(ch) != -1) {
encoded += ch;
} else {
var charCode = ch.charCodeAt(0);
if (charCode > 255) {
alert( "Unicode Character '"
+ ch
+ "' cannot be encoded using standard URL encoding.\n" +
"(URL encoding only supports 8-bit characters.)\n" +
"A space (+) will be substituted." );
encoded += "+";
} else {
encoded += "%";
encoded += HEX.charAt((charCode >> 4) & 0xF);
encoded += HEX.charAt(charCode & 0xF);
}
}
} // for
return encoded;
// document.URLForm.F2.value = encoded;
// return false;
}
function URLDecode( text )
{
// Replace + with ' '
// Replace %xx with equivalent character
// Put [ERROR] in output if %xx is invalid.
var HEXCHARS = "0123456789ABCDEFabcdef";
//var encoded = document.URLForm.F2.value;
var encoded = text;
var plaintext = "";
var i = 0;
while (i < encoded.length) {
var ch = encoded.charAt(i);
if (ch == "+") {
plaintext += " ";
i++;
} else if (ch == "%") {
if (i < (encoded.length-2)
&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1
&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
plaintext += unescape( encoded.substr(i,3) );
i += 3;
} else {
alert( 'Bad escape combination near ...' + encoded.substr(i) );
plaintext += "%[ERROR]";
i++;
}
} else {
plaintext += ch;
i++;
}
} // while
return plaintext;
// document.URLForm.F1.value = plaintext;
// return false;
};
function moveDiv(div, x , y)
{
var o = Get(div);
o.style.left = x;
o.style.top = y;
}
//*************** Gray out Functions **********************************
//
// global variables
//
//var isMozilla;
var objDiv = null;
var originalDivHTML = "";
var DivID = "";
var over = false;
//
// dinamically add a div to
// dim all the page
//
function buildDimmerDiv()
{
// document.write('<div id="dimmer" class="dimmer" style="width:'+ window.screen.width + 'px; height:' + window.screen.height +'px"></div>');
document.write('<div id="dimmer" class="dimmer" style="width:100%; height:100%; "></div>');
}
function init()
{
// check browser
///isMozilla = (document.all) ? 0 : 1;
//if (isMozilla)
//{
//document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
//}
//document.onmousedown = MouseDown;
// document.onmousemove = MouseMove;
//document.onmouseup = MouseUp;
// add the div
// used to dim the page
buildDimmerDiv();
}
// call init
//init();
function GrayOut1(value)
{
if(!value)
{
document.body.style.scrollbarBaseColor = '';
document.documentElement.scrollbarBaseColor = '';
document.getElementById('dimmer').style.visibility = "hidden";
//document.getElementById('dimmer').style.dislpay = "none";
}
else
{
document.body.style.scrollbarBaseColor = '#404040';
document.documentElement.scrollbarBaseColor = '#404040';
document.getElementById('dimmer').style.visibility = "visible";
// document.getElementById('dimmer').style.dislpay = "block";
}
scaleDiv() ;
}
function scaleDiv1() {
if (document.getElementById("dimmer") != null)
{
var scrollDiv = document.getElementById("dimmer");
//
//alert(scrollDiv.style.visibility );
if( scrollDiv.style.visibility != 'visible')
return;
var scalePercent = 0.80;//0.82
var wHeight = document.body.offsetHeight;
// var wHeight =document.documentElement.clientHeight;
if ( (wHeight > 600) && (wHeight < 900) )
{
scalePercent = 0.86;//0.86
}
else if ( wHeight > 900 )
{
scalePercent = 0.90;
}
//alert(wHeight);
scrollDiv.style.height = wHeight; // GetScrollTop();// wHeight * scalePercent;
}
}
function scaleDiv()
{
if (document.getElementById("dimmer") != null)
{
var wHeight = document.documentElement.offsetHeight;
var wWidth = document.documentElement.offsetWidth;
var scrollDiv = document.getElementById("dimmer");
scrollDiv.style.height = wHeight + GetScrollTop();
scrollDiv.style.width = wWidth;
}
}
function scaleDivTools()
{
if (document.getElementById("divChildTools_nav") != null)
{
var wHeight = document.documentElement.offsetHeight;
var scrollDiv = document.getElementById("divChildTools_nav");
scrollDiv.style.height = wHeight - 72;
}
}
//*************** Gray out Functions **********************************